package com.atguigu.service.impl;

import com.atguigu.config.SDKSendTemplateSMS;
import com.atguigu.service.MsmService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MsmServiceImpl implements MsmService{

    @Autowired
    private SDKSendTemplateSMS templateSMS;

    @Override
    public boolean send(String phone, String code) {
        //判断手机号是否为空
        if(StringUtils.isEmpty(phone)){
            return false;
        }

        //整合容联云短信服务
        return templateSMS.sms(phone, code);
    }
}
